home *** CD-ROM | disk | FTP | other *** search
- I had the opportunity to try the HP LaserJet Printer that the HP salesman left
- with me for a few days on the IBM-PC. I was impressed with the quality of the
- output. I connected an RS232 cable to the COM1 port and used the following
- software. "PRINT filename" will queue a file to the laser printer. To print in
- "landscape" orientation, "COPY LAND PRN" before giving the print command (uses
- the ROMAN 8 font cartridge).
-
- Ted Shapin, Oct. 18. 1984.
-
- In AUTOEXEC.BAT, add:
-
- mode com1:9600,n,8,1,p [sets the baud rate and 8-bits]
- xonxoff [this is a program that does x-on/x-off handshaking]
- copy port prn [this initializes the printer for portrait mode]
- - - - - - - - - - -
- This is the PORT file: [replace "#" by an escape character in the next lines]
- #&l0O#&l61F [set portrait orientation, 61 lines/page]
- #&a5L#&l6D [set left margin at 5, 6 lines/inch]
-
- This is the LAND file:
- #&l1O#(s17H#&l8D#&a20L [set landscape mode, font pitch to 17, 8 lines/inch
- left margin in column 20]
-
- - - - - - - - - - - - [assemble the following file and convert to .COM]
- page 60,132
- title xonxoff - asynch xon/xoff support
-
- ;
- ; XONXOFF - asychronous flow control using XON XOFF
- ; (DC1 and DC3 control characters)
- ;
- ; this routine replaces the MODE command redirection of
- ; LPT1 to COM1, in addition it handles the XON XOFF flow
- ; control
- ;
- ; note: this is a preliminary version, it will be modified
- ; to handle COM1 and COM2 and a Cntrl-break out of XOFF
- ; state
-
- ;
- ; Author: Jim Sturtevant
- ; Coherent Software
- ; June 23, 1983
- ; (415) 593-7567
- ;
- ; (c) Copyright, 1983, Coherent Software
- ;
- ;
- ; constant definition
- ;
- xon = 17 ;DC1, control-Q
- xoff = 19 ;DC3, control-S
- com_init_port = 0 ;from tech ref page a-20
- com_send = 1 ;doc for interupt 14h
- com_read = 2
- com_status = 3
- com_line = 0 ;0 = COM1:, 1 = COM2:
-
- com1_lsr = 3fdh
- com1_rbr = 3f8h
-
-
- ;
- ; define necessary segments
- ;
- stack segment para stack 'stack'
- db 28h dup ('stack')
- stack ends
-
- data segment para public 'data'
- msg db 'XON/XOFF Enabled$'
- data ends
-
- page
- ;
- ; initial code segement
- ;
- ; .changes INT 17h to point to this programs
- ; intr procedure
- ; .displays message
- ; .exits and stays resident
- ;
- code segment para public 'code'
- intload proc far
- assume cs:code,ds:data,ss:stack,es:nothing
- push ds
- mov ax,data ;point to our data segment
- mov ds,ax
- mov ax,0 ;es to point to interupt vec
- mov es,ax
- mov word ptr es:5ch,offset intr ;change interup rtn ptr
- mov ax,cs
- mov word ptr es:5eh,ax
-
- mov dx,offset msg
- mov ah,9
- int 21h ;display message (DOS)
-
- pop ds ;set up for exit stay res call
- sub ax,ax
- pushf
- push ds
- push ax
- mov dx,300h ;length of segment to retain
- mov ax,word ptr es:9eh
- push ax
- mov ax,word ptr es:9ch
- push ax
- ret
- intload endp
-
- page
- ;
- ; INTR - line printer interupt routine replacement
- ;
- ; .this routine checks the COM line for incomming
- ; characters before each character output
- ; .scan for XOFF if received wait for matching XON
- ; .otherwise output character
- ;
- intr proc far
- sti
- push ds
- push dx
- push cx
- push bx
- push ax
- or ah,ah ;func = 0 (write character)?
- jnz irtne ;no, exit
- call chkcom ;check for XOFF
- mov ah,com_send ;write character function
- mov dx,com_line ;com line number
- int 14h ;rs232 call
- jmp irtne
-
- irtne: pop ax
- mov ah,90h ;return no error status
- pop bx ;See INT 17h for doc on AH
- pop cx
- pop dx
- pop ds
- iret
- intr endp
-
- ;
- ; this routine checks to see if there is data avaialable
- ; from the COM line, if so the data is read in and checked
- ; for XOFF. If XOFF another loop is begun to wait for match
- ; ing XON.
- ;
- chkcom proc near
- push ax
-
- chkagain:
- mov ah,com_status ;return COM status in AX
- mov dx,com_line ;set port #
- int 14h
-
- and ah,1 ;data ready?
- jz chkexit ;no, return
-
- ; mov ah,com_read ;receive data
- ; int 14h
- mov dx,com1_rbr
- in al,dx
-
- cmp al,xoff ;pause output?
- jne chkagain ;nope, keep looking
-
- ;
- ; we have received an XOFF, loop until XON received
- ;
- xonloop: mov ah,com_status ;return COM status
- mov dx,com_line
- int 14h
-
- and ah,1 ;data available?
- jz xonloop ;no, keep checking
-
- ; mov ah,com_read ;yes, read it
- ; int 14h
- mov dx,com1_rbr
- in al,dx
-
- cmp al,xon ;did we get an unpause?
- jne xonloop ;nope, keep looking
- jmp chkagain ;ok, make check COM line
-
- chkexit: pop ax
- ret
- chkcom endp
-
-
- code ends
- end intload
-
-
-
-
-
-
-
-
-
-